{$layout "layout_popup"}

<h3>添加阈值</h3>
<form class="ui form" data-tea-action="$" data-tea-success="success">
    <csrf-token></csrf-token>
    <input type="hidden" name="clusterId" :value="clusterId" />
    <input type="hidden" name="nodeId" :value="nodeId"/>
    <input type="hidden" name="sumMethod" value="avg"/>

    <table class="ui table definition selectable">
        <tr>
            <td class="title">监控项 *</td>
            <td>
                <select class="ui dropdown auto-width" name="item" v-model="threshold.item" @change="changeItem">
                    <option v-for="item in items" :value="item.code">{{item.name}}</option>
                </select>
                <p class="comment">{{itemDescription}}</p>
            </td>
        </tr>
        <tr>
            <td>参数 *</td>
            <td>
                <select class="ui dropdown auto-width" name="param" v-model="threshold.param" @change="changeParam">
                    <option v-for="param in itemParams" :value="param.code">{{param.name}}</option>
                </select>
                <p class="comment">{{paramDescription}}</p>
            </td>
        </tr>
        <tr>
            <td>操作符 *</td>
            <td>
                <select class="ui dropdown auto-width" name="operator" v-model="threshold.operator">
                    <option v-for="operator in operators" :value="operator.code">{{operator.name}}</option>
                </select>
            </td>
        </tr>
        <tr>
            <td>对比值</td>
            <td>
                <input type="text" name="value" style="width: 6em" maxlength="10"/>
            </td>
        </tr>
        <tr>
            <td>统计时间段 *</td>
            <td>
                <div class="ui fields inline">
                    <div class="ui field">
                        <input type="text" name="duration" value="5" style="width: 5em"/>
                    </div>
                    <div class="ui field">
                        分钟
                        <!-- TODO 将来支持更多时间范围 -->
                        <input type="hidden" name="durationUnit" value="minute"/>
                    </div>
                </div>
            </td>
        </tr>
        <tr>
            <td colspan="2"><more-options-indicator></more-options-indicator></td>
        </tr>
        <tbody v-show="moreOptionsVisible">
            <tr>
                <td>消息</td>
                <td>
                    <textarea rows="2" maxlength="100" name="message"></textarea>
                    <p class="comment">触发阈值时的消息提示。</p>
                </td>
            </tr>
            <tr>
                <td>消息通知间隔</td>
                <td>
                    <div class="ui fields inline">
                        <div class="ui field">
                            <input type="text" name="notifyDuration" value="10" style="width: 5em"/>
                        </div>
                        <div class="ui field">
                            分钟
                        </div>
                    </div>
                    <p class="comment">在此间隔内将不会重复发送跟此阈值相关的消息。</p>
                </td>
            </tr>
        </tbody>
    </table>

    <submit-btn></submit-btn>
</form>